home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
comm
/
term
/
term34Source.lha
/
TerminalPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
19KB
|
710 lines
/*
** TerminalPanel.c
**
** Editing panel for terminal configuration
**
** Copyright © 1990-1993 by Olaf `Olsen' Barthel & MXM
** All Rights Reserved
*/
#include "termGlobal.h"
enum { GAD_BELLMODE, GAD_ALERTMODE,GAD_EMULATIONMODE, GAD_EMULATION, GAD_SELECT_EMULATION,GAD_FONTMODE,
GAD_FONT, GAD_SELECT_FONT,GAD_SEND_CR, GAD_SEND_LF,GAD_RECEIVE_CR, GAD_RECEIVE_LF,
GAD_NUMCOLUMNS, GAD_NUMLINES, GAD_KEYMAP, GAD_SELECT_KEYMAP,
GAD_USE, GAD_CANCEL,GAD_DEFAULT };
STATIC STRPTR BellType[6],
AlertType[5],
EmulationType[6],
FontType[4],
CRType[4],
LFType[4];
STATIC WORD LocalMaxColumns,
LocalMaxLines;
STATIC STRPTR __saveds
ShowColumn(struct Gadget *SomeGadget,WORD Level)
{
STATIC UBYTE Buffer[10];
if(Level == LocalMaxColumns + 1)
strcpy(Buffer,LocaleString(MSG_TERMINALPANEL_MAXIMUM_TXT));
else
SPrintf(Buffer,LocaleBase ? "%9lD" : "%9ld",Level);
return(Buffer);
}
STATIC STRPTR __saveds
ShowLine(struct Gadget *SomeGadget,WORD Level)
{
STATIC UBYTE Buffer[10];
if(Level == LocalMaxLines + 1)
strcpy(Buffer,LocaleString(MSG_TERMINALPANEL_MAXIMUM_TXT));
else
SPrintf(Buffer,LocaleBase ? "%9lD" : "%9ld",Level);
return(Buffer);
}
STATIC struct Gadget *
CreateAllGadgets(struct Configuration *ConfigPtr,struct Gadget *GadgetArray[],struct Gadget **GadgetList,BYTE *Default)
{
struct Gadget *Gadget;
struct NewGadget NewGadget;
UWORD Counter = 0;
SZ_SizeSetup(Window -> WScreen,&UserFont,TRUE);
LocalizeString(BellType,MSG_TERMINALPANEL_BELL_IGNORE_TXT,MSG_TERMINALPANEL_BELL_DEFAULT_TXT);
LocalizeString(AlertType,MSG_TERMINALPANEL_ALERT_NONE_TXT,MSG_TERMINALPANEL_ALERT_SIGNAL_SCREEN_TXT);
LocalizeString(EmulationType,MSG_TERMINALPANEL_EMULATION_ANSI_VT102_TXT,MSG_TERMINALPANEL_EMULATION_HEX_TXT);
LocalizeString(FontType,MSG_TERMINALPANEL_FONT_STANDARD_TXT,MSG_TERMINALPANEL_FONT_PC_RAW);
LocalizeString(CRType,MSG_TERMINALPANEL_DOCR_IGNORE_TXT,MSG_TERMINALPANEL_DOCR_AS_CR_LF_TXT);
LocalizeString(LFType,MSG_TERMINALPANEL_DOLF_IGNORE_TXT,MSG_TERMINALPANEL_DOLF_AS_LF_CR_TXT);
memset(&NewGadget,0,sizeof(struct NewGadget));
if(Gadget = CreateContext(GadgetList))
{
LONG Level;
SZ_AddLeftOffset(SZ_LeftOffsetDelta(MSG_TERMINALPANEL_BELL_GAD,MSG_TERMINALPANEL_TEXT_FONT_GAD));
SZ_ResetMaxWidth();
SZ_UpdateMaxWidth(CYCLE_KIND,NULL,0,BellType);
SZ_UpdateMaxWidth(CYCLE_KIND,NULL,0,AlertType);
SZ_UpdateMaxWidth(CYCLE_KIND,NULL,0,EmulationType);
SZ_UpdateMaxWidth(FOLDER_KIND,NULL,20,NULL);
SZ_UpdateMaxWidth(CYCLE_KIND,NULL,0,FontType);
SZ_UpdateMaxWidth(TEXT_KIND,NULL,20,NULL);
SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_TERMINALPANEL_SELECT_NEW_TEXT_GAD),0,NULL);
SZ_SetWidth(SZ_ResetMaxWidth());
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_BELL_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, BellType,
GTCY_Active, ConfigPtr -> TerminalConfig -> BellMode,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_ALERT_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, AlertType,
GTCY_Active, ConfigPtr -> TerminalConfig -> AlertMode,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_EMULATION_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, EmulationType,
GTCY_Active, ConfigPtr -> TerminalConfig -> EmulationMode,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_EMULATION_NAME_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_LeaveFolder, TRUE,
GTST_MaxChars, 255,
GTST_String, ConfigPtr -> TerminalConfig -> EmulationFileName,
TAG_DONE);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_PlaceLeft, TRUE,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_FONT_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, FontType,
GTCY_Active, ConfigPtr -> TerminalConfig -> FontMode,
GA_Disabled, ConfigPtr -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_TEXT_FONT_GAD);
NewGadget . ng_GadgetID = Counter;
SPrintf(SharedBuffer,"%s %ld",ConfigPtr -> TerminalConfig -> TextFontName,ConfigPtr -> TerminalConfig -> TextFontHeight);
GadgetArray[Counter++] = Gadget = CreateGadget(TEXT_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTTX_Text, SharedBuffer,
GTTX_Border, TRUE,
GTTX_CopyText, TRUE,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_SELECT_NEW_TEXT_GAD);
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_Flags = 0;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
TAG_DONE);
SZ_AddLeftOffset(SZ_LeftOffsetDelta(MSG_TERMINALPANEL_SEND_CR_GAD,MSG_TERMINALPANEL_KEYMAP_FILE_GAD));
SZ_UpdateMaxWidth(CYCLE_KIND,NULL,0,CRType);
SZ_UpdateMaxWidth(CYCLE_KIND,NULL,0,LFType);
SZ_UpdateMaxWidth(FOLDER_KIND,NULL,20,NULL);
SZ_SetWidth(SZ_ResetMaxWidth());
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_SEND_CR_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_NewColumn, TRUE,
GTCY_Labels, CRType,
GTCY_Active, ConfigPtr -> TerminalConfig -> SendCR,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_SEND_LF_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, LFType,
GTCY_Active, ConfigPtr -> TerminalConfig -> SendLF,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_RECEIVE_CR_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, CRType,
GTCY_Active, ConfigPtr -> TerminalConfig -> ReceiveCR,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_RECEIVE_LF_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(CYCLE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTCY_Labels, LFType,
GTCY_Active, ConfigPtr -> TerminalConfig -> ReceiveLF,
TAG_DONE);
if(ConfigPtr != Config)
{
LocalMaxColumns = 132;
LocalMaxLines = 64;
}
else
{
LocalMaxColumns = WindowWidth / TextFontWidth;
LocalMaxLines = WindowHeight / TextFontHeight;
}
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_NUMCOLUMNS_GAD);
NewGadget . ng_GadgetID = Counter;
if(ConfigPtr -> TerminalConfig -> NumColumns < 20)
Level = LocalMaxColumns + 1;
else
Level = ConfigPtr -> TerminalConfig -> NumColumns;
GadgetArray[Counter++] = Gadget = CreateGadget(SLIDER_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTSL_Min, 20,
GTSL_Max, LocalMaxColumns + 1,
GTSL_Level, Level,
GTSL_DispFunc, ShowColumn,
GTSL_LevelFormat, "%s",
GTSL_MaxLevelLen, 9,
TAG_DONE);
if(ConfigPtr -> TerminalConfig -> NumLines < 20)
Level = LocalMaxLines + 1;
else
Level = ConfigPtr -> TerminalConfig -> NumLines;
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_NUMLINES_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(SLIDER_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
GTSL_Min, 20,
GTSL_Max, LocalMaxLines + 1,
GTSL_Level, Level,
GTSL_DispFunc, ShowLine,
GTSL_LevelFormat, "%s",
GTSL_MaxLevelLen, 9,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_TERMINALPANEL_KEYMAP_FILE_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_LeaveFolder, TRUE,
GTST_MaxChars, 255,
GTST_String, ConfigPtr -> TerminalConfig -> KeyMapFileName,
TAG_DONE);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_PlaceLeft, TRUE,
TAG_DONE);
SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_USE_GAD),0,NULL);
SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_CANCEL_GAD),0,NULL);
SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_DEFAULT_GAD),0,NULL);
SZ_SetWidth(SZ_ResetMaxWidth());
NewGadget . ng_GadgetText = LocaleString(MSG_GLOBAL_USE_GAD);
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_Flags = 0;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_AlignExtra, TRUE,
SZ_AlignLeft, TRUE,
SZ_AlignBottom, TRUE,
TAG_DONE);
NewGadget . ng_GadgetText = LocaleString(MSG_GLOBAL_CANCEL_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_AlignRight, TRUE,
TAG_DONE);
if(Default)
{
NewGadget . ng_GadgetText = LocaleString(MSG_GLOBAL_DEFAULT_GAD);
NewGadget . ng_GadgetID = Counter;
GadgetArray[Counter] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
SZ_Adjust, TRUE,
SZ_AutoWidth, TRUE,
SZ_AlignCentre, TRUE,
TAG_DONE);
}
}
return(Gadget);
}
/* SelectKeymap(UBYTE *Name,struct Window *ParentWindow):
*
* Select a new keymap file using the asl.library file requester.
*/
STATIC BYTE
SelectKeymap(UBYTE *Name,struct Window *ParentWindow)
{
struct FileRequester *AslFileRequest;
UBYTE *File,*Temp;
BYTE NewMap = FALSE;
File = Name;
strcpy(SharedBuffer,File);
Temp = PathPart(SharedBuffer);
Temp[0] = 0;
if(!SharedBuffer[0])
{
APTR OldPtr = ThisProcess -> pr_WindowPtr;
BPTR FileLock;
ThisProcess -> pr_WindowPtr = (APTR)-1;
if(FileLock = Lock("KEYMAPS:",ACCESS_READ))
{
strcpy(SharedBuffer,"KEYMAPS:");
UnLock(FileLock);
}
else
strcpy(SharedBuffer,"Devs:Keymaps");
ThisProcess -> pr_WindowPtr = OldPtr;
}
File = FilePart(File);
if(AslFileRequest = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
ASL_Window, ParentWindow,
ASL_File, File,
ASL_Dir, SharedBuffer,
ASL_Hail, LocaleString(MSG_TERMINALPANEL_SELECT_KEYMAP_TXT),
ASL_FuncFlags, FILF_NEWIDCMP,
ASL_OKText, LocaleString(MSG_GLOBAL_SELECT_TXT),
TAG_END))
{
if(AslRequestTags(AslFileRequest,TAG_DONE))
{
if(AslFileRequest -> rf_File[0])
{
strcpy(SharedBuffer,AslFileRequest -> rf_Dir);
if(!AddPart(SharedBuffer,AslFileRequest -> rf_File,MAX_FILENAME_LENGTH))
strcpy(SharedBuffer,AslFileRequest -> rf_File);
if(Stricmp(SharedBuffer,Name))
{
strcpy(Name,SharedBuffer);
NewMap = TRUE;
}
}
}
FreeAslRequest(AslFileRequest);
}
return(NewMap);
}
BYTE
TerminalPanel(struct Configuration *Config,BYTE *Default)
{
struct Window *PanelWindow;
struct Gadget *GadgetList = NULL;
struct Gadget *GadgetArray[GAD_DEFAULT + 1];
UBYTE DummyBuffer[MAX_FILENAME_LENGTH];
LONG MinWidth,MinHeight,
MaxWidth,MaxHeight;
Forbid();
MinWidth = Window -> MinWidth;
MinHeight = Window -> MinHeight;
MaxWidth = Window -> MaxWidth;
MaxHeight = Window -> MaxHeight;
WindowLimits(Window,Window -> Width,Window -> Height,Window -> Width,Window -> Height);
Permit();
SaveConfig(Config,PrivateConfig);
if(CreateAllGadgets(Config,GadgetArray,&GadgetList,Default))
{
if(PanelWindow = OpenWindowTags(NULL,
WA_Left, GetScreenLeft(Window) + (GetScreenWidth(Window) - SZ_GetWindowWidth()) / 2,
WA_Top, GetScreenTop(Window) + (GetScreenHeight(Window) - SZ_GetWindowHeight()) / 2,
WA_Width, SZ_GetWindowWidth(),
WA_Height, SZ_GetWindowHeight(),
WA_Activate, TRUE,
WA_DragBar, TRUE,
WA_DepthGadget, TRUE,
WA_RMBTrap, TRUE,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_CustomScreen,Window -> WScreen,
WA_IDCMP, IDCMP_ACTIVEWINDOW | IDCMP_CLOSEWINDOW | IDCMP_RAWKEY | IDCMP_VANILLAKEY | IDCMP_GADGETDOWN | SLIDERIDCMP | BUTTONIDCMP | CHECKBOXIDCMP | CYCLEIDCMP | STRINGIDCMP,
WA_Title, LocaleString(MSG_TERMINALPANEL_TERMINAL_PREFERENCES_TXT),
TAG_DONE))
{
struct IntuiMessage *Massage;
ULONG IClass,Code;
struct Gadget *Gadget;
BYTE Terminated = FALSE;
GuideContext(CONTEXT_TERMINAL);
PushWindow(PanelWindow);
AddGList(PanelWindow,GadgetList,(UWORD)-1,(UWORD)-1,NULL);
RefreshGList(GadgetList,PanelWindow,NULL,(UWORD)-1);
GT_RefreshWindow(PanelWindow,NULL);
GT_SetGadgetAttrs(GadgetArray[GAD_FONTMODE],PanelWindow,NULL,
GA_Disabled, Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
GT_SetGadgetAttrs(GadgetArray[GAD_SELECT_FONT],PanelWindow,NULL,
GA_Disabled, Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
ActiveGadget = NULL;
ClrSignal(SIG_BREAK);
while(!Terminated)
{
if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
{
SaveConfig(PrivateConfig,Config);
break;
}
while(!Terminated && (Massage = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort)))
{
IClass = Massage -> Class;
Code = Massage -> Code;
Gadget = (struct Gadget *)Massage -> IAddress;
GT_ReplyIMsg(Massage);
KeySelect(GadgetArray,GAD_CANCEL,Code,PanelWindow,&Gadget,&IClass,&Code);
if(IClass == IDCMP_GADGETDOWN)
{
if((Gadget -> GadgetType & GTYP_GTYPEMASK) == GTYP_STRGADGET)
ActiveGadget = Gadget;
}
if(IClass == IDCMP_ACTIVEWINDOW && ActiveGadget)
ActivateGadget(ActiveGadget,PanelWindow,NULL);
if(IClass == IDCMP_CLOSEWINDOW)
{
SaveConfig(PrivateConfig,Config);
Terminated = TRUE;
}
if(IClass == IDCMP_MOUSEMOVE)
{
switch(Gadget -> GadgetID)
{
case GAD_NUMCOLUMNS:
Config -> TerminalConfig -> NumColumns = Code % (LocalMaxColumns + 1);
break;
case GAD_NUMLINES:
Config -> TerminalConfig -> NumLines = Code % (LocalMaxLines + 1);
break;
}
}
if(IClass == IDCMP_GADGETUP)
{
switch(Gadget -> GadgetID)
{
case GAD_BELLMODE:
Config -> TerminalConfig -> BellMode = Code;
break;
case GAD_ALERTMODE:
Config -> TerminalConfig -> AlertMode = Code;
break;
case GAD_EMULATIONMODE:
Config -> TerminalConfig -> EmulationMode = Code;
/*
GT_SetGadgetAttrs(GadgetArray[GAD_NUMCOLUMNS],PanelWindow,NULL,
GA_Disabled, Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
GT_SetGadgetAttrs(GadgetArray[GAD_NUMLINES],PanelWindow,NULL,
GA_Disabled, Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
*/
GT_SetGadgetAttrs(GadgetArray[GAD_SELECT_FONT],PanelWindow,NULL,
GA_Disabled, Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
GT_SetGadgetAttrs(GadgetArray[GAD_FONTMODE],PanelWindow,NULL,
GA_Disabled, Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL,
TAG_DONE);
break;
case GAD_FONTMODE:
Config -> TerminalConfig -> FontMode = Code;
break;
case GAD_SEND_CR:
Config -> TerminalConfig -> SendCR = Code;
break;
case GAD_SEND_LF:
Config -> TerminalConfig -> SendLF = Code;
break;
case GAD_RECEIVE_CR:
Config -> TerminalConfig -> ReceiveCR = Code;
break;
case GAD_RECEIVE_LF:
Config -> TerminalConfig -> ReceiveLF = Code;
break;
case GAD_NUMCOLUMNS:
Config -> TerminalConfig -> NumColumns = Code % (LocalMaxColumns + 1);
break;
case GAD_NUMLINES:
Config -> TerminalConfig -> NumLines = Code % (LocalMaxLines + 1);
break;
case GAD_SELECT_EMULATION:
BlockWindow(PanelWindow);
strcpy(DummyBuffer,SZ_GetString(GadgetArray[GAD_EMULATION]));
strcpy(SharedBuffer,DummyBuffer);
if(PickFile("Libs:","xem#?.library",LocaleString(MSG_TERMINALPANEL_SELECT_EMULATOR_TXT),SharedBuffer))
{
if(Stricmp(SharedBuffer,DummyBuffer))
{
GT_SetGadgetAttrs(GadgetArray[GAD_EMULATION],PanelWindow,NULL,
GTST_String,SharedBuffer,
TAG_DONE);
}
}
ReleaseWindow(PanelWindow);
break;
case GAD_SELECT_KEYMAP:
BlockWindow(PanelWindow);
strcpy(DummyBuffer,SZ_GetString(GadgetArray[GAD_KEYMAP]));
if(SelectKeymap(DummyBuffer,PanelWindow))
{
GT_SetGadgetAttrs(GadgetArray[GAD_KEYMAP],PanelWindow,NULL,
GTST_String,DummyBuffer,
TAG_DONE);
}
ReleaseWindow(PanelWindow);
break;
case GAD_SELECT_FONT:
BlockWindow(PanelWindow);
if(PickFont(PanelWindow,Config -> TerminalConfig -> TextFontName,&Config -> TerminalConfig -> TextFontHeight,TRUE))
{
SPrintf(SharedBuffer,"%s %ld",Config -> TerminalConfig -> TextFontName,Config -> TerminalConfig -> TextFontHeight);
GT_SetGadgetAttrs(GadgetArray[GAD_FONT],PanelWindow,NULL,
GTTX_Text, SharedBuffer,
TAG_DONE);
}
ReleaseWindow(PanelWindow);
break;
case GAD_USE:
Terminated = TRUE;
strcpy(Config -> TerminalConfig -> KeyMapFileName, SZ_GetString(GadgetArray[GAD_KEYMAP]));
strcpy(Config -> TerminalConfig -> EmulationFileName, SZ_GetString(GadgetArray[GAD_EMULATION]));
if(!Config -> TerminalConfig -> EmulationFileName[0] && Config -> TerminalConfig -> EmulationMode == EMULATION_EXTERNAL)
Config -> TerminalConfig -> EmulationMode = EMULATION_ANSIVT100;
break;
case GAD_CANCEL:
Terminated = TRUE;
SaveConfig(PrivateConfig,Config);
break;
case GAD_DEFAULT:
*Default = TRUE;
Terminated = TRUE;
break;
}
}
}
}
RemoveGList(PanelWindow,GadgetList,(UWORD)-1);
PopWindow();
CloseWindow(PanelWindow);
}
}
FreeGadgets(GadgetList);
WindowLimits(Window,MinWidth,MinHeight,MaxWidth,MaxHeight);
return((BYTE)memcmp(PrivateConfig -> TerminalConfig,Config -> TerminalConfig,sizeof(struct TerminalSettings)));
}